# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from ..MessageAnalysis import*

class JT_8803:
    result = []
    s=""
    def LogicAisle(self, protocolStr, header):
        count = 0
        s=protocolStr[count:count + 2]
        header.append("多媒体类型：" + s )
        if s=="00":
            header.append("图像" +"\n")
            count = count + 2
        elif s=="01":
            header.append("音频" + "\n")
            count = count + 2
        elif s == "02":
            header.append("视频" + "\n")
            count = count + 2
        s = protocolStr[count:count + 2]
        header.append("通道ID：")
        if s=="00":
            header.append(s +"检索该媒体类型的所有通道" + "\n")
            count = count + 2
        else:
            header.append(s + "\n")
            count = count + 2
        s = protocolStr[count:count + 2]
        header.append("事件项编码：")
        if s == "00":
            header.append(s + " 平台下指令" + "\n")
        elif s == "01":
            header.append(s + " 定时动作" + "\n")
        elif s == "02":
            header.append(s + " 抢劫报警触发" + "\n")
        elif s == "03":
            header.append(s + " 碰撞侧翻报警触发" + "\n")
        count = count + 2
        s = protocolStr[count:count + 12]
        c = 0
        t = s[c:c + 2]
        header.append("起始时间:"+t )
        c = c + 2
        for i in range(5):
            t = s[c:c + 2]
            header.append("-"+ t )
            c=c + 2
        count= count + 12
        header.append("\n")
        d = 0
        s = protocolStr[count:count + 12]
        t = s[d:d + 2]
        header.append("结束时间:"+t)
        d = d + 2
        for i in range(5):
            t = s[d:d + 2]
            header.append("-" + t)
            d = d + 2
        count=count+12
        header.append("\n")
        s=s = protocolStr[count:count + 2]
        header.append("删除标志：")
        if s=="00":
            header.append(" 保留" + "\n")
        if s=="01":
            header.append(" 删除" + "\n")
            
        
        self.result = header

